package org.act.xservices.rt.xcontainer.service.resolver;

import org.act.xservices.rt.xcontainer.inf.context.IServiceContext;
import org.act.xservices.rt.xcontainer.inf.service.wsdl.XcOperation;
import org.act.xservices.rt.xcontainer.inf.service.wsdl.XcService;

/**
 * 
 * @LastModifyTime 2009-4-15
 * @CreationTime
 * @author Lizq [lizq@act.buaa.edu.cn]
 * @since JDK1.5
 */
public class ActionBasedOperationResolver extends AbstractOperationResolver {

	private final static String NAME = "ActionBasedOperationResolver";
	

	@Override
	protected void init() {
		this.name = NAME;

	}
	
	@Override
	public XcOperation findOperation(IServiceContext serviceContext)
			throws ResolverProcessException {
		
		XcService xcService = serviceContext.getXcService();
		
		String action = serviceContext.getMessageContext().getAction();
		
		if( xcService!=null && action!=null ){
			
			return xcService.getOperationByAction(action);
			
		}else{
			
			return null;
			
		}
	}

}
